﻿using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DeepCompare.Tests
{
    /// <summary>
    ///     Test fixture for <see cref="TypeExtensions" />.
    /// </summary>
    [TestClass]
    public class TypeExtensionsTestFixture
    {
        /// <summary>
        ///     Checks the get base types method (<see cref="TypeExtensions.GetBaseTypes" />).
        /// </summary>
        [TestMethod]
        public void CheckGetBaseTypes()
        {
            var baseTypes = typeof(TestClassWithOwnEquality).GetBaseTypes();
            Assert.AreEqual(3,
                baseTypes.GetLength(0));
            Assert.AreEqual(baseTypes[0],
                typeof(TestClassWithOwnEquality));
            Assert.AreEqual(baseTypes[1],
                typeof(TestClassOne));
            Assert.AreEqual(baseTypes[2],
                typeof(object));
        }

        /// <summary>
        ///     Checks the <see cref="TypeExtensions.GetDefaultValue" /> method.
        /// </summary>
        [TestMethod]
        public void CheckGetDefaultValue()
        {
            Assert.AreEqual(default(int),
                typeof(int).GetDefaultValue());
            Assert.AreEqual(default(short),
                typeof(short).GetDefaultValue());
        }
    }
}